import Vue from 'vue'
// import VueRouter from 'vue-router'
const Msite = () => import('@/views/msite/MSite.vue')
const Search = () => import('@/views/search/Search.vue')
const Order = () => import('@/views/order/Order.vue')
const Profile = () => import('@/views/profile/Profile.vue')
const Login = () => import('@/views/login/Login.vue')
const UserCenter = () => import('@/views/userCenter/UserCenter.vue')
const Shop = () => import('@/views/shop/Shop.vue')
const Goods = () => import('@/views/shop/goods/Goods.vue')
const Merchants = () => import('@/views/shop/merchants/Merchants.vue')
const Score = () => import('@/views/shop/score/Score.vue')
const NotFound = () => import('@/views/not-found/404.vue') 

Vue.use(VueRouter)

  const routes = [
  {
    path: '/msite',
    component: Msite,
    meta:{
      showTabBar: true
    }
  },
  {
    path: '/search',
    component: Search,
    meta:{
      showTabBar: true
    }
  },
  {
    path: '/order',
    component: Order,
    meta:{
      showTabBar: true
    }
  },
  {
    path: '/profile',
    component: Profile,
    meta:{
      showTabBar: true
    },
  },
  {
    path: '/usercenter',
    component: UserCenter,
    meta:{
      showTabBar: true
    },
  },
  {
    path: '/login',
    component: Login,
    meta:{
      showTabBar: false
    }
  },
  {
    path: '/shop',
    component: Shop,
    meta:{
      showTabBar: false
    },
    children:[
      {
        path: '/shop/goods',
        component: Goods,
      },
      {
        path: '/shop/merchants',
        component: Merchants,
      },
      {
        path: '/shop/score',
        component: Score,
      },
      {
        path: '/shop',
        redirect: '/shop/goods'
      }
    ]
  },
  {
    path: '/',
    redirect: '/msite'
  },
  { // 配置404组件, 放在最后
    path: '/*',
    component: NotFound
  },
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
